UK Map Plots
Contents
UK Map Plots#
Inputs#
import pandas as pd
from pathlib import Path
import src.utils.map_utils as mu
import os
import sys
file = os.path.join(cwd , "data", "combined_df.csv")
df = pd.read_csv(file, index_col=0)
address_col = "address_area"
df_comb = df.groupby(address_col,as_index=False).mean(numeric_only = True)
df_comb
| address_area | amount_detected | mrl | amount_pc | |
|---|---|---|---|---|
| 0 | Bedfordshire | 0.387000 | 2.373583 | 0.124811 |
| 1 | Berkshire | 0.196747 | 4.103357 | 0.742296 |
| 2 | Bristol | 0.268374 | 3.802430 | 0.170047 |
| 3 | Buckinghamshire | 0.050278 | 2.033333 | 0.098907 |
| 4 | Cambridgeshire | 0.512300 | 3.449771 | 0.092681 |
| 5 | Central Scotland | 0.064576 | 2.270339 | 0.220675 |
| 6 | Cheshire | 0.331614 | 3.441020 | 0.185064 |
| 7 | City of London | 0.488811 | 3.619672 | 0.045385 |
| 8 | Cornwall | 1.455588 | 7.805294 | 0.227373 |
| 9 | County Durham | 0.294703 | 4.774372 | 0.665944 |
| 10 | Cumbria | 0.206752 | 2.578974 | 0.073641 |
| 11 | Derbyshire | 0.296042 | 2.601042 | 0.086572 |
| 12 | Devon | 0.142708 | 3.093401 | 0.705448 |
| 13 | Dorset | 0.191635 | 1.853846 | 0.069592 |
| 14 | East Riding of Yorkshire | 0.294501 | 2.818758 | 0.241039 |
| 15 | East Sussex | 0.143893 | 2.445503 | 0.130867 |
| 16 | Essex | 0.468930 | 3.579789 | 0.324051 |
| 17 | Glasgow | 0.040593 | 1.450247 | 0.620967 |
| 18 | Gloucestershire | 0.115163 | 2.559455 | 0.109277 |
| 19 | Greater London | 0.224690 | 2.950398 | 0.168093 |
| 20 | Greater Manchester | 0.296786 | 3.689802 | 0.218737 |
| 21 | Hampshire | 0.538559 | 4.580920 | 1.157321 |
| 22 | Herefordshire | 1.370909 | 6.681515 | 0.099744 |
| 23 | Hertfordshire | 0.170821 | 3.124670 | 0.323446 |
| 24 | Kent | 0.344766 | 3.836676 | 0.097400 |
| 25 | Lancashire | 0.660758 | 5.865546 | 0.630129 |
| 26 | Leicestershire | 0.421726 | 4.812516 | 0.425529 |
| 27 | Lincolnshire | 0.720843 | 4.731526 | 0.090207 |
| 28 | Lothian | 0.134729 | 3.337831 | 0.079409 |
| 29 | Merseyside | 0.231206 | 3.589798 | 0.300602 |
| 30 | Mid Scotland and Fife | 0.165261 | 2.422155 | 0.355315 |
| 31 | Mid Wales | 0.060000 | 2.200000 | 0.026667 |
| 32 | Norfolk | 0.664853 | 4.288339 | 0.099100 |
| 33 | North East Scotland | 0.155392 | 2.930369 | 0.580549 |
| 34 | North Wales | 0.116242 | 2.562393 | 0.440996 |
| 35 | North Yorkshire | 0.275897 | 4.012571 | 0.124751 |
| 36 | Northamptonshire | 0.189718 | 2.327817 | 0.151279 |
| 37 | Northern Ireland | 0.203477 | 3.522473 | 0.320456 |
| 38 | Northumberland | 3.262500 | 5.000000 | 0.326250 |
| 39 | Nottinghamshire | 0.143738 | 4.401028 | 0.328896 |
| 40 | Oxfordshire | 0.136477 | 2.394375 | 0.074221 |
| 41 | Shropshire | 0.408955 | 3.994234 | 0.087272 |
| 42 | Somerset | 0.229284 | 3.201288 | 1.566792 |
| 43 | South East Wales | 1.259286 | 6.635000 | 0.131259 |
| 44 | South Scotland | 0.037000 | 0.332500 | 0.220143 |
| 45 | South Wales | 0.304305 | 3.650880 | 0.887286 |
| 46 | South West Wales | 0.247053 | 3.380015 | 0.100246 |
| 47 | South Yorkshire | 0.276270 | 4.235202 | 0.068786 |
| 48 | Staffordshire | 0.349470 | 4.100943 | 0.076136 |
| 49 | Suffolk | 0.335813 | 3.599019 | 0.153761 |
| 50 | Surrey | 0.139565 | 3.829293 | 0.494966 |
| 51 | Tyne and Wear | 0.303136 | 3.644100 | 0.440443 |
| 52 | Warwickshire | 0.432370 | 4.770462 | 0.149471 |
| 53 | West Midlands | 0.169469 | 2.723310 | 0.263257 |
| 54 | West Scotland | 0.139068 | 2.318882 | 0.164127 |
| 55 | West Sussex | 0.034615 | 1.788462 | 0.037361 |
| 56 | West Yorkshire | 0.301004 | 4.128642 | 0.858317 |
| 57 | Wiltshire | 0.122906 | 2.839687 | 0.075442 |
| 58 | Worcestershire | 0.174147 | 2.542257 | 0.163471 |
m = mu.plot_map(df,
what_to_plot='amount_pc',region_to_plot=address_col,
json_path=os.path.join(cwd,'src//utils//map_data//combined_json.json'),
longitude=-3.1, latitude=54.1)
m
Make this Notebook Trusted to load map: File -> Trust Notebook